package com.aj.activity.dialog;

import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import com.aj.activity.R;

public class SexChooseDialog extends BaseDialog {

	private TextView man_text;

	private TextView women_text;

	private TextView confidential_text;

	private IChooseSexInterface chooseSexInterface;

	private Context context;

	public interface IChooseSexInterface {
		public void chooseSex(String sex);
	}

	public SexChooseDialog(Context context) {
		super(context, R.layout.dialog_sex_choose);
		this.context = context;
	}

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		man_text = (TextView) findViewById(R.id.man_text);
		women_text = (TextView) findViewById(R.id.women_text);
		confidential_text = (TextView) findViewById(R.id.confidential_text);
		ClickEvent clickEvent = new ClickEvent();
		man_text.setOnClickListener(clickEvent);
		women_text.setOnClickListener(clickEvent);
		confidential_text.setOnClickListener(clickEvent);
	}

	class ClickEvent implements View.OnClickListener {

		@Override
		public void onClick(View v) {
			switch (v.getId()) {
			case R.id.man_text:
				if (chooseSexInterface != null) {
					chooseSexInterface.chooseSex(context
							.getString(R.string.sex_man_text));
				}
				break;
			case R.id.women_text:
				if (chooseSexInterface != null) {
					chooseSexInterface.chooseSex(context
							.getString(R.string.sex_woman_text));
				}
				break;
			case R.id.confidential_text:
				if (chooseSexInterface != null) {
					chooseSexInterface.chooseSex(context
							.getString(R.string.sex_confidential_text));
				}
				break;
			default:
				break;
			}
			dismiss();
		}
	}

	public IChooseSexInterface getChooseSexInterface() {
		return chooseSexInterface;
	}

	public void setChooseSexInterface(IChooseSexInterface chooseSexInterface) {
		this.chooseSexInterface = chooseSexInterface;
	}

}
